#include:
#    - base.jdk.jdk8

elastic-tar-install:
    file.managed: #cp文件到minion端
        - name: /usr/local/src/elasticsearch-7.2.0-x86_64.rpm
        - source: salt://files/elasticsearch-7.2.0-x86_64.rpm
        - user: root
        - group: root
        - mode: 644

    cmd.run: #执行本地命令
        - name:  rpm -ivh  /usr/local/src/elasticsearch-7.2.0-x86_64.rpm  && mkdir /data/elasticsearch  -p&& chown elasticsearch:elasticsearch /data/elasticsearch -R
        - unless: rpm -q elasticsearch

elastic-config:
    file.managed:
        - name: /etc/elasticsearch/elasticsearch.yml
        - source: salt://files/elasticsearch-template.yml
        - user: root
        - group: elasticsearch
        - mode: 644
        - onlyif: rpm -q elasticsearch
